﻿<controls:MetroWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:model="clr-namespace:MyJournalTracker.Model"
        xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls1="clr-namespace:MyJournalTracker.Controls"
    mc:Ignorable="d" x:Class="MyJournalTracker.MainWindow"
        Title="MyJournalTracker" Height="350" Width="525">
    <controls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />
				<ResourceDictionary Source="Resources/Icons.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        	<Storyboard x:Key="OnClick1">
        		<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="textBlock">
        			<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        			<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
        			<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
        		</DoubleAnimationUsingKeyFrames>
        		<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="TextBox">
        			<EasingColorKeyFrame KeyTime="0:0:0.5" Value="#FFEAE7FF"/>
        			<EasingColorKeyFrame KeyTime="0:0:1" Value="White"/>
        		</ColorAnimationUsingKeyFrames>
        		<Int32AnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.RowSpan)" Storyboard.TargetName="TextBox">
        			<DiscreteInt32KeyFrame KeyTime="0" Value="1"/>
        			<DiscreteInt32KeyFrame KeyTime="0:0:1" Value="2"/>
        		</Int32AnimationUsingKeyFrames>
        		<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="InfoBorder">
        			<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
        			<DiscreteObjectKeyFrame KeyTime="0:0:1" Value="{x:Static Visibility.Collapsed}"/>
        		</ObjectAnimationUsingKeyFrames>
        	</Storyboard>
        </ResourceDictionary>
    </controls:MetroWindow.Resources>
	<controls:MetroWindow.Triggers>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
			<BeginStoryboard Storyboard="{StaticResource OnClick1}"/>
		</EventTrigger>
	</controls:MetroWindow.Triggers>
    <controls:MetroWindow.DataContext>
        <model:Entry EntryText="Please enter your journal entry" />
    </controls:MetroWindow.DataContext>
	<controls:MetroWindow.WindowCommands>
	<controls:WindowCommands>
        <Button Content="settings" />
		</controls:WindowCommands>
	</controls:MetroWindow.WindowCommands>
	<Grid>
		<Grid.Resources>
			<RoutedUICommand x:Key="SaveCommand" Text="Save" />
			<RoutedUICommand x:Key="SnipCommand" Text="Snip" />
		</Grid.Resources>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="100"/>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>

		<Grid.CommandBindings>
			<CommandBinding Command="{StaticResource SaveCommand}" 
				Executed="SaveEntry" />
			<CommandBinding Command="{StaticResource SnipCommand}" 
				Executed="SnipPicture" />
		</Grid.CommandBindings>

		<Grid.InputBindings>
			<KeyBinding Key="S" Modifiers="Ctrl" Command="{StaticResource SaveCommand}" />
			<KeyBinding Key="P" Modifiers="Ctrl" Command="{StaticResource SnipCommand}" />
		</Grid.InputBindings>
		<Grid.RowDefinitions>
			<RowDefinition Height="60"/>
			<RowDefinition Height="235*"/>
			<RowDefinition Height="24*"/>
		</Grid.RowDefinitions>
		<Grid Grid.Column="1" Margin="0">
			<Grid.RowDefinitions>
				<RowDefinition Height="59*"/>
				<RowDefinition/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition/>
				<ColumnDefinition Width="150"/>
			</Grid.ColumnDefinitions>
			<StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="1" Margin="0,5,0,4" >
			<StackPanel.Resources>
				<SolidColorBrush x:Key="BlackBrush" Color="black" />
			</StackPanel.Resources>
				<Button Content="{DynamicResource appbar_image_focus}" Style="{DynamicResource MetroCircleButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" Height="50" Click="SnipButtonClick">
				</Button>
				<Button Content="{DynamicResource appbar_image}" Style="{DynamicResource MetroCircleButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" Height="50"  Click="PictureButtonClick"/>
				<Button x:Name="button" Content="{DynamicResource appbar_save}" Style="{DynamicResource MetroCircleButtonStyle}"  HorizontalAlignment="Left" VerticalAlignment="Top" Width="50" Height="50"  Click="SaveButtonClick"/>
			</StackPanel>
            <ComboBox x:Name="notebookComboBox" Margin="10,17,10,16" VerticalAlignment="Center" HorizontalContentAlignment="Stretch" ItemsSource="{Binding NotebookList}"
                      SelectedValue="{Binding EntryNotebookName}" IsEditable="True" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="false" />
		</Grid>
		<TextBox x:Name="TextBox" Grid.Row="1" TextWrapping="Wrap" controls:TextboxHelper.Watermark="Please enter your journal Entry" Text="{Binding EntryText}" AcceptsReturn="True" AutoWordSelection="True" AcceptsTab="True" Grid.ColumnSpan="2" Grid.RowSpan="3"/>
		<Border Background="#FF9FB6F3" BorderBrush="Black" BorderThickness="0,0,1,1" Grid.ColumnSpan="1" >
			<Image x:Name="Picture" OpacityMask="White" MouseUp="PictureMouseUp" Source="{Binding EntryPicture, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Stretch="UniformToFill" Margin="0"/>
		</Border>
		<Border x:Name="InfoBorder" Grid.ColumnSpan="2" Margin="0,0,0,0" Grid.Row="2" Height="24" VerticalAlignment="Bottom" Visibility="Collapsed" >
			<TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="Entry saved." HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Segoe UI Black" FontSize="13.333" Foreground="#FF7A7A7A"/>
		</Border>
	</Grid>
</controls:MetroWindow>
